home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / mathematica / tex-mma.tar_z / tex-mma / addBBox next >
Text File  |  1991-02-04  |  870b  |  41 lines

  1. #! /bin/sh
  2. cmd=addBBox
  3.  
  4. # cmd height fontsize
  5. # Filter to set bounding box of Mathematica graphics for inclusion in TeX
  6.  
  7. # 2/4/1991 adaptation by Dan Dill dan@chem.bu.edu of
  8. # original written by Cameron Smith cameron@midd.bitnet
  9. # to set fontsize
  10.  
  11. if [ $# -lt 2 ]
  12. then
  13. echo Usage: $cmd height fontsize
  14. echo Adjust height and fontsize of Mathematica graphics.
  15. echo See the $cmd shell script for details
  16. exit 1
  17. fi
  18.  
  19. height=$1
  20. fontsize=$2
  21.  
  22. # save the graphic in a temp file
  23. cat >/tmp/mmatemp.$$.ps
  24.  
  25. # get width
  26. asprat=`awk '/AspectRatio/&&flag==0 {print $2; flag=1}' /tmp/mmatemp.$$.ps`
  27. width=`echo "$height / $asprat" | bc`
  28.  
  29. # emit header
  30. echo "%%BoundingBox: 0 0 $width $height"
  31. echo "/Mfontsize $fontsize def"
  32. echo "/Mwidth $width def"
  33. echo "/Mheight $height def"
  34. echo "/Mnodistort true def"
  35.  
  36. # copy file
  37. cat /tmp/mmatemp.$$.ps
  38.  
  39. # remove temp file
  40. rm /tmp/mmatemp.$$.ps
  41.